<template>
    <div class="table">
        <div class="divSearch">
            <!--搜索框-->
            <Row>
                <Col :lg="{span:5}" :md="{span:8}" :sm="{span:16}" :xs="{span:22}">
                <label class="searchLabel">填报年度:</label>
                <Select v-model="searchModel.FillInYear" placeholder="全部" :label-in-value="true" @on-change="GetData()" class="searchInput">
                    <Option :value="item.DictText" v-for="item in CreateYearList" :key="item.DictValue">{{item.DictText}}</Option>
                </Select>
                </Col>
                <Col :lg="{span:2}" :md="{span:2}" :sm="{span:2}" :xs="{span:2}" v-show="isFull">
                <Button icon="ios-search" type="primary" @click="GetData()" class="searchButton">查询</Button>
                </Col>
                <Col :lg="{span:2}" :md="{span:2}" :sm="{span:2}" :xs="{span:2}" style="float:right">
                    <Button v-show="DataModel.ReportStatus>1" icon="ios-download" type="primary" @click="ExcelDown()" class="searchButton">数据导出</Button>
                </Col> 
                <Col :lg="{span:2}" :md="{span:2}" :sm="{span:2}" :xs="{span:2}" style="float:right" v-show="DataModel.ReportStatus<3&&isFull">
                    <Upload :on-success="handleSuccess" :action="GetPostUrl()" >
                        <Button type="primary" icon="ios-cloud-upload-outline" class="searchButton">数据导入</Button>
                    </Upload>
                </Col>
                <Col :lg="{span:2}" :md="{span:2}" :sm="{span:2}" :xs="{span:2}"  style="float:right">
                    <Button icon="ios-cloud-download" type="primary" @click="TmpDown()" class="searchButton">模板下载</Button>
                </Col>
            </Row>
        </div>
        <Row>
            <Col>
                <div v-if="isFull">
                    <Form ref="DataModel" :model="DataModel" :rules="ruleModel">
                        <table class="reportTable">
                            <caption>
                                    <label style="float:left">(九){{searchModel.FillInYear}}蔬菜技术推广机构及人员情况统计表(全面统计)</label>
                                    <label style="float:right">当前状态:
                                        <span v-if="DataModel.ReportStatus==0" class="Error">退回重报</span> 
                                        <span v-else-if="DataModel.ReportStatus==1" class="NoReport">未填写</span>
                                        <span v-else-if="DataModel.ReportStatus==2" class="AlreadyReport">已填写</span>
                                        <span v-else-if="DataModel.ReportStatus==3" class="UpReport">已上报</span>
                                        <span v-else-if="DataModel.ReportStatus==4" class="Success">审核通过</span>               
                                        <span v-else class="NoReport">无需填报</span>               
                                    </label>
                            </caption>
                            <thead>
                                <tr>
                                    <td width="45%"></td>
                                    <td width="15%">汇总代码</td>
                                    <td width="15%">数量</td>
                                </tr>
                                <tr>
                                    <td>甲</td>
                                    <td>已</td>
                                    <td>1</td>
                                </tr>
                            </thead>
                            <tr  class="disableTd">
                                <td class="tdLeft">一、蔬菜技术服务机构数（个）</td>
                                <td>1</td>
                                <td class="disableTd">
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldInstituNum">
                                        <Form-item prop="InstituNum">
                                            <Input v-model="DataModel.InstituNum=InstituNum" disabled readonly></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr>
                                <td class="tdLeftOne">其中：州市级</td>
                                <td>2</td>
                                <td>
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldInstituNum_City">
                                        <Form-item prop="InstituNum_City">
                                            <Input v-model="DataModel.InstituNum_City"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr>
                                <td class="tdLeftTwo">县级</td>
                                <td>3</td>
                                <td>
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldInstituNum_Area">
                                        <Form-item prop="InstituNum_Area">
                                            <Input v-model="DataModel.InstituNum_Area"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr>
                                <td class="tdLeftTwo">乡镇级</td>
                                <td>4</td>
                                <td>
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldInstituNum_town">
                                        <Form-item prop="InstituNum_town">
                                            <Input v-model="DataModel.InstituNum_town"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr  class="disableTd">
                                <td class="tdLeft">二、专业技术人员数量(人)</td>
                                <td>5</td>
                                <td class="disableTd">
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_Num">
                                        <Form-item prop="PeopleNum_Num">
                                            <Input v-model="DataModel.PeopleNum_Num=PeopleNum_Num" disabled readonly></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr>
                                <td class="tdLeftOne">其中：州市级人数</td>
                                <td>6</td>
                                <td class="disableTd">
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_City">
                                        <Form-item prop="PeopleNum_City">
                                            <Input v-model="DataModel.PeopleNum_City"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr>
                                <td class="tdLeftTwo">县乡级人数</td>
                                <td>7</td>
                                <td class="disableTd">
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_Area">
                                        <Form-item prop="PeopleNum_Area">
                                            <Input v-model="DataModel.PeopleNum_Area"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr  class="disableTd">
                                <td class="tdLeftOne">(一)按性别分</td>
                                <td>8</td>
                                <td></td>
                            </tr>
                            <tr>
                                <td class="tdLeftTwo">其中：男</td>
                                <td>9</td>
                                <td>
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_man">
                                        <Form-item prop="PeopleNum_man">
                                            <Input v-model="DataModel.PeopleNum_man"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr>
                                <td class="tdLeftThree">女</td>
                                <td>9</td>
                                <td>
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_woman">
                                        <Form-item prop="PeopleNum_woman">
                                            <Input v-model="DataModel.PeopleNum_woman"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr  class="disableTd">
                                <td class="tdLeftOne">(二)按年龄分</td>
                                <td>10</td>
                                <td></td>
                            </tr>
                            <tr>
                                <td class="tdLeftTwo">其中：30岁以下(含30)</td>
                                <td>11</td>
                                <td>
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_age1">
                                        <Form-item prop="PeopleNum_age1">
                                            <Input v-model="DataModel.PeopleNum_age1"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr>
                                <td class="tdLeftThree">30-40岁(含40)</td>
                                <td>12</td>
                                <td>
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_age2">
                                        <Form-item prop="PeopleNum_age2">
                                            <Input v-model="DataModel.PeopleNum_age2"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr>
                                <td  class="tdLeftThree">40-50岁(含50)</td>
                                <td>13</td>
                                <td>
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_age3">
                                        <Form-item prop="PeopleNum_age3">
                                            <Input v-model="DataModel.PeopleNum_age3"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr>
                                <td class="tdLeftThree">50岁以上</td>
                                <td>14</td>
                                <td>
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_age4">
                                        <Form-item prop="PeopleNum_age4">
                                            <Input v-model="DataModel.PeopleNum_age4"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr  class="disableTd">
                                <td class="tdLeftOne">(三)按学历层次分</td>
                                <td>15</td>
                                <td></td>
                            </tr>
                            <tr>
                                <td class="tdLeftTwo">其中：硕士及以上</td>
                                <td>16</td>
                                <td>
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_xlss">
                                        <Form-item prop="PeopleNum_xlss">
                                            <Input v-model="DataModel.PeopleNum_xlss"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr>
                                <td class="tdLeftThree">本科</td>
                                <td>17</td>
                                <td>
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_xlbk">
                                        <Form-item prop="PeopleNum_xlbk">
                                            <Input v-model="DataModel.PeopleNum_xlbk"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr>
                                <td class="tdLeftThree">大专</td>
                                <td>18</td>
                                <td>
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_xldz">
                                        <Form-item prop="PeopleNum_xldz">
                                            <Input v-model="DataModel.PeopleNum_xldz"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr>
                                <td class="tdLeftThree">中专(技校)</td>
                                <td>19</td>
                                <td>
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_xlzz">
                                        <Form-item prop="PeopleNum_xlzz">
                                            <Input v-model="DataModel.PeopleNum_xlzz"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr>
                                <td class="tdLeftThree">其他学历</td>
                                <td>20</td>
                                <td>
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_xlqt">
                                        <Form-item prop="PeopleNum_xlqt">
                                            <Input v-model="DataModel.PeopleNum_xlqt"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr  class="disableTd">
                                <td class="tdLeftOne">(四)职称情况</td>
                                <td>21</td>
                                <td></td>
                            </tr>
                            <tr>
                                <td class="tdLeftTwo">其中：正高级职称</td>
                                <td>22</td>
                                <td>
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_zczgj">
                                        <Form-item prop="PeopleNum_zczgj">
                                            <Input v-model="DataModel.PeopleNum_zczgj"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr>
                                <td class="tdLeftThree">副高级职称</td>
                                <td>23</td>
                                <td>
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_zcfgj">
                                        <Form-item prop="PeopleNum_zcfgj">
                                            <Input v-model="DataModel.PeopleNum_zcfgj"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr>
                                <td  class="tdLeftThree">中级职称</td>
                                <td>24</td>
                                <td>
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_zczj">
                                        <Form-item prop="PeopleNum_zczj">
                                            <Input v-model="DataModel.PeopleNum_zczj"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr>
                                <td  class="tdLeftThree">初级职称</td>
                                <td>25</td>
                                <td>
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_zccj">
                                        <Form-item prop="PeopleNum_zccj">
                                            <Input v-model="DataModel.PeopleNum_zccj"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                            <tr>
                                <td class="tdLeftThree"> 其他职称</td>
                                <td>26</td>
                                <td>
                                    <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_zcqt">
                                        <Form-item prop="PeopleNum_zcqt">
                                            <Input v-model="DataModel.PeopleNum_zcqt"></Input>
                                        </Form-item>
                                    </Poptip>
                                </td>
                            </tr>
                        </table>
                    </Form>
                    <div class="divButton">
                        <Button type="primary" @click="save('DataModel')" :disabled="DataModel.ReportStatus < 3 && BtnSaveStatus ? false:true">保存</Button>
                        <Button type="primary" @click="DataUp(DataModel.ReportId)" :disabled="DataModel.ReportStatus == 2 ? false:true">上报</Button>
                    </div>
                </div>
                <div class="FIllTip" v-else>温馨提示:本时段不在系统报表填报时间内，请耐心等待。</div>
                <div style="margin-bottom:50px;">
                    <Alert class="alert" banner type="error">
                        <p>填报时间：每年1月10日</p>
                        <p>1.全省范围内从乡（镇）起，逐级全面统计，由县级填报经州（市）审核后上报。</p>
                        <span slot="desc"></span>
                    </Alert>
                </div>
            </Col>
        </Row>
    </div>
</template>
<script>
export default {
    data() {
        const validateData = (rule, value, callback) => {
            var temp = /^[0-9]\d*(\.\d+)?$/;
            if (value != null && value != "") {
                if (temp.test(value) == false) {
                    callback(new Error('必须是大于0的数字'));
                }
                else {
                    callback();
                }
            } else {
                callback();
            }
        };
        return {
            self: this,
            CreateYearList: this.GetGroupDict("ReportYear"), //年度
            CurrentYear: this.GetCurrentYear(),//当前年度
            BtnSaveStatus: false,//保存按钮开关
            //查询模型：根据需求删除不不要查询条件
            //蔬菜生产情况表代码
            searchModel: {
                Id: '',
                ReportCode: 'VegTecPromotion',
                FillInYear: '',
                TimesType: '',
                AreaCode: this.GetlocaStorage("VegUserInfo").AreaCode,
                PageNumber: 1,
                PageSize: 20,
                Status: '',
                Opinion: ''
            },
            DataModel: {
                Id: '',
                ReportId: '',
                InstituNum: '',
                InstituNum_City: '',
                InstituNum_Area: '',
                InstituNum_town: '',
                PeopleNum: '',
                PeopleNum_City: '',
                PeopleNum_Area: '',
                PeopleNum_man: '',
                PeopleNum_woman: '',
                PeopleNum_age1: '',
                PeopleNum_age2: '',
                PeopleNum_age3: '',
                PeopleNum_age4: '',
                PeopleNum_xlss: '',
                PeopleNum_xlbk: '',
                PeopleNum_xldz: '',
                PeopleNum_xlzz: '',
                PeopleNum_xlqt: '',
                PeopleNum_zczgj: '',
                PeopleNum_zcfgj: '',
                PeopleNum_zczj: '',
                PeopleNum_zccj: '',
                PeopleNum_zcqt: '',
                ReportStatus: '',
                //******************上年数据 */
                OldId: '',
                OldReportId: '',
                OldInstituNum: '',
                OldInstituNum_City: '',
                OldInstituNum_Area: '',
                OldInstituNum_town: '',
                OldPeopleNum: '',
                OldPeopleNum_City: '',
                OldPeopleNum_Area: '',
                OldPeopleNum_man: '',
                OldPeopleNum_woman: '',
                OldPeopleNum_age1: '',
                OldPeopleNum_age2: '',
                OldPeopleNum_age3: '',
                OldPeopleNum_age4: '',
                OldPeopleNum_xlss: '',
                OldPeopleNum_xlbk: '',
                OldPeopleNum_xldz: '',
                OldPeopleNum_xlzz: '',
                OldPeopleNum_xlqt: '',
                OldPeopleNum_zczgj: '',
                OldPeopleNum_zcfgj: '',
                OldPeopleNum_zczj: '',
                OldPeopleNum_zccj: '',
                OldPeopleNum_zcqt: '',
                OldReportStatus: '',
            },
            ruleModel: {
                InstituNum: [{ validator: validateData, trigger: 'blur' }],
                InstituNum_City: [{ validator: validateData, trigger: 'blur' }],
                InstituNum_Area: [{ validator: validateData, trigger: 'blur' }],
                InstituNum_town: [{ validator: validateData, trigger: 'blur' }],
                // PeopleNum: [{ validator: validateData, trigger: 'blur' }],
                // PeopleNum_City: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_Area: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_man: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_woman: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_age1: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_age2: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_age3: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_age4: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_xlss: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_xlbk: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_xldz: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_xlzz: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_xlqt: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_zczgj: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_zcfgj: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_zczj: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_zccj: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_zcqt: [{ validator: validateData, trigger: 'blur' }]
            }
        }
    },
    computed: { //
        InstituNum:{
            get:function(){
                var InstituNum_City = this.DataModel.InstituNum_City == null ? 0 : Number(this.DataModel.InstituNum_City);
                var InstituNum_Area = this.DataModel.InstituNum_Area == null ? 0 : Number(this.DataModel.InstituNum_Area);
                var InstituNum_town = this.DataModel.InstituNum_town == null ? 0 : Number(this.DataModel.InstituNum_town);
                var total=InstituNum_City+InstituNum_Area+InstituNum_town
                return total;
            }
        }
        ,
        PeopleNum_Num: {//总人数
            get: function () {
                //*******性别 */
                var PeopleNum_man = this.DataModel.PeopleNum_man == null ? 0 : Number(this.DataModel.PeopleNum_man);
                var PeopleNum_woman = this.DataModel.PeopleNum_woman == null ? 0 : Number(this.DataModel.PeopleNum_woman);
                //****年龄段 */
                var PeopleNum_age1 = this.DataModel.PeopleNum_age1 == null ? 0 : Number(this.DataModel.PeopleNum_age1);
                var PeopleNum_age2 = this.DataModel.PeopleNum_age2 == null ? 0 : Number(this.DataModel.PeopleNum_age2);
                var PeopleNum_age3 = this.DataModel.PeopleNum_age3 == null ? 0 : Number(this.DataModel.PeopleNum_age3);
                var PeopleNum_age4 = this.DataModel.PeopleNum_age4 == null ? 0 : Number(this.DataModel.PeopleNum_age4);
                //******学历 */
                var PeopleNum_xlss = this.DataModel.PeopleNum_xlss == null ? 0 : Number(this.DataModel.PeopleNum_xlss);
                var PeopleNum_xlbk = this.DataModel.PeopleNum_xlbk == null ? 0 : Number(this.DataModel.PeopleNum_xlbk);
                var PeopleNum_xldz = this.DataModel.PeopleNum_xldz == null ? 0 : Number(this.DataModel.PeopleNum_xldz);
                var PeopleNum_xlzz = this.DataModel.PeopleNum_xlzz == null ? 0 : Number(this.DataModel.PeopleNum_xlzz);
                var PeopleNum_xlqt = this.DataModel.PeopleNum_xlqt == null ? 0 : Number(this.DataModel.PeopleNum_xlqt);
                //******职称 */
                var PeopleNum_zczgj = this.DataModel.PeopleNum_zczgj == null ? 0 : Number(this.DataModel.PeopleNum_zczgj);
                var PeopleNum_zcfgj = this.DataModel.PeopleNum_zcfgj == null ? 0 : Number(this.DataModel.PeopleNum_zcfgj);
                var PeopleNum_zczj = this.DataModel.PeopleNum_zczj == null ? 0 : Number(this.DataModel.PeopleNum_zczj);
                var PeopleNum_zccj = this.DataModel.PeopleNum_zccj == null ? 0 : Number(this.DataModel.PeopleNum_zccj);
                var PeopleNum_zcqt = this.DataModel.PeopleNum_zcqt == null ? 0 : Number(this.DataModel.PeopleNum_zcqt);

                var total1 = PeopleNum_man + PeopleNum_woman;//性别
                var total2 = PeopleNum_age1 + PeopleNum_age2 + PeopleNum_age3 + PeopleNum_age4;//年龄段
                var total3 = PeopleNum_xlss + PeopleNum_xlbk + PeopleNum_xldz + PeopleNum_xlzz + PeopleNum_xlqt;//学历
                var total4 = PeopleNum_zczgj + PeopleNum_zcfgj + PeopleNum_zczj + PeopleNum_zccj + PeopleNum_zcqt;//职称
                if (total1 == total2 && total1 == total3 && total1 == total4 && total2 == total3 && total2 == total4 && total3 == total4)//平衡关系正确
                {
                    return total1;
                }
                else {
                    return '';
                }
            }
        },
    },
    methods: {
        // checkInstitu() {//机构数据校验
        //     var InstituNum = this.DataModel.InstituNum;
        //     var InstituNum_City = this.DataModel.InstituNum_City;
        //     var InstituNum_Area = this.DataModel.InstituNum_Area;
        //     var InstituNum_town = this.DataModel.InstituNum_town;
        //     if (InstituNum == null) {
        //         if (InstituNum_City != null && InstituNum_Area != null || InstituNum_town != null) {
        //             this.$Modal.error({
        //                 title: "提示信息",
        //                 content: "蔬菜机构总数为空,子项不为空!!!"
        //             });
        //             return false;
        //         } else {//机构数据全部为空(表示没有)
        //             return true;
        //         }
        //     }
        //     else {
        //         InstituNum = InstituNum == null ? 0 : Number(InstituNum);
        //         InstituNum_City = InstituNum_City == null ? 0 : Number(InstituNum_City);
        //         InstituNum_Area = InstituNum_Area == null ? 0 : Number(InstituNum_Area);
        //         InstituNum_town = InstituNum_town == null ? 0 : Number(InstituNum_town);
        //         if (InstituNum != InstituNum_City + InstituNum_Area + InstituNum_town) {
        //             this.$Modal.error({
        //                 title: "提示信息",
        //                 content: "蔬菜机构总数=州市机构数+区县机构数+乡镇机构数!!!"
        //             });
        //             return false;
        //         }
        //         else {
        //             return true;
        //         }
        //     }
        // },
        // checkPeople() {//蔬菜专业技术人员
        //     // var PeopleNum = this.DataModel.PeopleNum;
        //     // var PeopleNum_City = this.DataModel.PeopleNum_City;
        //     var PeopleNum_Area = this.DataModel.PeopleNum_Area;
        //     var PeopleNum_man = this.DataModel.PeopleNum_man;
        //     var PeopleNum_woman = this.DataModel.PeopleNum_woman;
        //     var PeopleNum_age1 = this.DataModel.PeopleNum_age1;
        //     var PeopleNum_age2 = this.DataModel.PeopleNum_age2;
        //     var PeopleNum_age3 = this.DataModel.PeopleNum_age3;
        //     var PeopleNum_age4 = this.DataModel.PeopleNum_age4;
        //     var PeopleNum_xlss = this.DataModel.PeopleNum_xlss;
        //     var PeopleNum_xlbk = this.DataModel.PeopleNum_xlbk;
        //     var PeopleNum_xldz = this.DataModel.PeopleNum_xldz;
        //     var PeopleNum_xlzz = this.DataModel.PeopleNum_xlzz;
        //     var PeopleNum_xlqt = this.DataModel.PeopleNum_xlqt;
        //     var PeopleNum_zczgj = this.DataModel.PeopleNum_zczgj;
        //     var PeopleNum_zcfgj = this.DataModel.PeopleNum_zcfgj;
        //     var PeopleNum_zczj = this.DataModel.PeopleNum_zczj;
        //     var PeopleNum_zccj = this.DataModel.PeopleNum_zccj;
        //     var PeopleNum_zcqt = this.DataModel.PeopleNum_zcqt;
        //     if (PeopleNum_Area == null || PeopleNum_Area == "") {
        //         if (PeopleNum_man != null || PeopleNum_woman != null || PeopleNum_age1 != null || PeopleNum_age2 != null || PeopleNum_age3 != null || PeopleNum_age4 != null || PeopleNum_xlss != null || PeopleNum_xlbk != null || PeopleNum_xldz != null || PeopleNum_xlzz != null || PeopleNum_xlqt != null || PeopleNum_zczgj != null || PeopleNum_zcfgj != null || PeopleNum_zczj != null || PeopleNum_zccj != null || PeopleNum_zcqt != null) {
        //             this.$Modal.error({
        //                 title: "提示信息",
        //                 content: "总人数为空,其他子项不为空!!!"
        //             });
        //             return false;
        //         }
        //         else {
        //             return true
        //         }
        //     }
        //     else {
        //         // PeopleNum = PeopleNum == null ? 0 : Number(PeopleNum);
        //         // PeopleNum_City = PeopleNum_City == null ? 0 : Number(PeopleNum_City);
        //         PeopleNum_Area = PeopleNum_Area == null ? "" : Number(PeopleNum_Area);
        //         PeopleNum_man = PeopleNum_man == null ? 0 : Number(PeopleNum_man);
        //         PeopleNum_woman = PeopleNum_woman == null ? 0 : Number(PeopleNum_woman);
        //         PeopleNum_age1 = PeopleNum_age1 == null ? 0 : Number(PeopleNum_age1);
        //         PeopleNum_age2 = PeopleNum_age2 == null ? 0 : Number(PeopleNum_age2);
        //         PeopleNum_age3 = PeopleNum_age3 == null ? 0 : Number(PeopleNum_age3);
        //         PeopleNum_age4 = PeopleNum_age4 == null ? 0 : Number(PeopleNum_age4);
        //         PeopleNum_xlss = PeopleNum_xlss == null ? 0 : Number(PeopleNum_xlss);
        //         PeopleNum_xlbk = PeopleNum_xlbk == null ? 0 : Number(PeopleNum_xlbk);
        //         PeopleNum_xldz = PeopleNum_xldz == null ? 0 : Number(PeopleNum_xldz);
        //         PeopleNum_xlzz = PeopleNum_xlzz == null ? 0 : Number(PeopleNum_xlzz);
        //         PeopleNum_xlqt = PeopleNum_xlqt == null ? 0 : Number(PeopleNum_xlqt);
        //         PeopleNum_zczgj = PeopleNum_zczgj == null ? 0 : Number(PeopleNum_zczgj);
        //         PeopleNum_zcfgj = PeopleNum_zcfgj == null ? 0 : Number(PeopleNum_zcfgj);
        //         PeopleNum_zczj = PeopleNum_zczj == null ? 0 : Number(PeopleNum_zczj);
        //         PeopleNum_zccj = PeopleNum_zccj == null ? 0 : Number(PeopleNum_zccj);
        //         PeopleNum_zcqt = PeopleNum_zcqt == null ? 0 : Number(PeopleNum_zcqt);
        //         if (PeopleNum_Area != (PeopleNum_man + PeopleNum_woman)) {
        //             this.$Modal.error({
        //                 title: "提示信息",
        //                 content: "总人数=男人数+女人数!!!"
        //             });
        //             return false;
        //         }
        //         else if (PeopleNum_Area != (PeopleNum_age1 + PeopleNum_age2 + PeopleNum_age3 + PeopleNum_age4)) {
        //             this.$Modal.error({
        //                 title: "提示信息",
        //                 content: "总人数=30岁以下(含30岁)+30-40岁(含40岁)+40-50岁(含50岁)+50岁以上!!!"
        //             });
        //             return false;
        //         }
        //         else if (PeopleNum_Area != (PeopleNum_xlss + PeopleNum_xlbk + PeopleNum_xldz + PeopleNum_xlzz + PeopleNum_xlqt)) {
        //             this.$Modal.error({
        //                 title: "提示信息",
        //                 content: "总人数=硕士及以上+本科+大专+中专（技校）+其他!!!"
        //             });
        //             return false;
        //         }
        //         else if (PeopleNum_Area != (PeopleNum_zczgj + PeopleNum_zcfgj + PeopleNum_zczj + PeopleNum_zccj + PeopleNum_zcqt)) {
        //             this.$Modal.error({
        //                 title: "提示信息",
        //                 content: "总人数=正高级职称+副高级职称+中级职称+初级职称+其他!!!"
        //             });
        //             return false;
        //         }
        //         else {
        //             return true;
        //         }
        //     }
        // },
        // checkData() {
        //     if (this.checkInstitu() && this.checkPeople()) {
        //         return true;
        //     } else {
        //         return false;
        //     }
        // },
        //获取今往年数据
        GetData: function () {
            var self = this;
            var model = new Object();
            model.ReportCode = self.searchModel.ReportCode;
            if (self.searchModel.FillInYear != null && self.searchModel.FillInYear != '') {
                self.isFull= self.IsFillForTableYear(parseInt(self.searchModel.FillInYear));
                model.FillInYear = self.searchModel.FillInYear;
            } else {
                self.isFull= self.IsFillForTableYear(self.CurrentYear);
                model.FillInYear = self.CurrentYear + '年';//填报年度-----数据字典值
                self.searchModel.FillInYear = self.CurrentYear + '年';
            }
            model.AreaCode = self.searchModel.AreaCode;
            self.DataModel = {};//清空当前数据            
            self.$http.post("Report/PostData", model).then( //获取数据编辑项的值
                function (res) {
                    if (res.data.list.status == 2 || res.data.list.status == 1) {
                        self.DataModel = res.data.list.model;
                        self.BtnSaveStatus = true;
                    } else {
                        self.DataModel = res.data.list.model;
                        self.$Modal.warning({
                            title: "提示信息",
                            content: res.data.list.message
                        });
                        self.BtnSaveStatus = false;
                    }
                }
            );
        },
        //保存方法
        save(name) {
            var self = this;
            this.$refs[name].validate((valid) => {
                if (valid) {
                    // if (self.checkData()) {
                        this.$http.put('VegTecPromotion', self.DataModel).then(
                            function (res) {
                                if (res.data.status == 1) {
                                    self.GetData();
                                    self.$Notice.success({
                                        title: '数据保存成功！',
                                        desc: false
                                    });
                                } else {
                                    self.$Modal.warning({
                                        title: "提示信息",
                                        content: "更新失败,请与管理员联系!"
                                    });
                                }
                            });
                    // }
                    // else {
                    //     self.$Modal.warning({
                    //         title: "提示信息",
                    //         content: "数据保存失败，请检查数据平衡关系是否正确!"
                    //     });
                    // }
                }
                else {
                    this.$Message.error('数据验证失败，请检查后再试!');
                }
            });
        },
        //数据上报
        DataUp: function () {
            var self = this;
            var model = new Object();
            model.Id = self.DataModel.ReportId;
            model.Status = 3;
            model.Opinion = '';
            self.$Modal.confirm({
                title: '提示信息',
                content: '<p>数据上报后，不能再更改，是否继续上报？</p>',
                onOk: () => {
                    self.$http.post('Report/PostUpStatus', model).then(function (res) {
                        if (res.data.status === 1) {
                            self.$Notice.success({
                                title: '数据上报成功',
                                desc: false
                            });
                            self.GetData();
                        } else {
                            self.$Notice.success({
                                title: '数据上报失败',
                                desc: res.data.messages
                            });
                        }
                    });
                },
                onCancel: () => { }
            });
        },
        //模板下载
        TmpDown: function () {
            window.open(this.$http.defaults.baseURL + "Report/GetTemplateData?ReportCode=" + this.searchModel.ReportCode);
        },
        //导出
        ExcelDown: function () {
            var self = this;
            var model = new Object();
            model.ReportCode = self.searchModel.ReportCode;
            if (self.searchModel.FillInYear != null && self.searchModel.FillInYear != '') {
                model.FillInYear = self.searchModel.FillInYear;
            } else {
                model.FillInYear = self.CurrentYear + '年';//填报年度-----数据字典值
                self.searchModel.FillInYear = self.CurrentYear + '年';
            }
            model.AreaCode = self.searchModel.AreaCode;
            window.open(this.$http.defaults.baseURL + "VegTecPromotion/GetExcelData?ReportCode=" + model.ReportCode + "&&FillInYear=" + model.FillInYear + "&&AreaCode=" + model.AreaCode);
        },
        //导入
        GetPostUrl() {
            var url = this.$http.defaults.baseURL + "Report/PostImportData?ReportCode=" + this.searchModel.ReportCode + "&&AreaCode=" + this.searchModel.AreaCode + "&&FillInYear=" + this.searchModel.FillInYear;
            return url;
        },
        handleSuccess(res, file) {
            var self = this;
            self.GetData();
            self.$Notice.success({
                title: '数据导入成功！',
                desc: false
            });
        },
    },
    //创建Vue页面方法
    created: function () {
        //创业Vue前调用获取this.datas: {},//table数据对象
        this.GetData();
    },
    watch: {
        //需要监听的在此处新增监听对象
    }
}
</script>